package main

import (
	"data-process/config"
	"data-process/logger"
	"data-process/produce"
	_ "embed"
	"fmt"
	"os"
)

//go:embed config/banner.txt
var banner []byte

func Banner() {
	//file, _ := os.Open("./config/banner.txt")
	//defer file.Close()
	//content, _ := ioutil.ReadAll(banner)
	fmt.Println(string(banner))
}

////go:embed views/*
//var view embed.FS

func main() {
	Banner()

	//mux := http.DefaultServeMux
	//mux.Handle("/", AssetHandler("/", view, "./views"))
	//http.ListenAndServe(":9999", mux)

	config.InitConfig(os.Args)
	logger.InitLogger()
	produce.DefaultProduce()
}

//type fsFunc func(name string) (fs.File, error)
//
//func (f fsFunc) Open(name string) (fs.File, error) {
//	return f(name)
//}
//
//func AssetHandler(prefix string, assets embed.FS, root string) http.Handler {
//	handler := fsFunc(func(name string) (fs.File, error) {
//		assetPath := path.Join(root, name)
//
//		// If we can't find the asset, fs can handle the error
//		file, err := assets.Open(assetPath)
//		if err != nil {
//			return nil, err
//		}
//
//		// Otherwise assume this is a legitimate request routed correctly
//		return file, err
//	})
//
//	return http.StripPrefix(prefix, http.FileServer(http.FS(handler)))
//}
